package com.util;


import android.content.Context;
import android.widget.Toast;

/**
 * Created by fei on 2017/6/20.
 */

public class ToastUtils {

    private static Toast mToast;

    public static void init(Context context) {
        mToast = Toast.makeText(context, null, Toast.LENGTH_SHORT);
    }

    public static void show(int resId) {
        mToast.setText(resId);
        mToast.show();
    }

    public static void show(CharSequence charSequence) {
        mToast.setText(charSequence);
        mToast.show();
    }
    public static void showContext(Context context,CharSequence charSequence) {
        mToast.setText(charSequence);
        mToast.show();
    }


    private static Toast toast;

    public static void showToast(Context context,
                                 String content) {
        if (toast == null) {
            toast = Toast.makeText(context,
                    content,
                    Toast.LENGTH_SHORT);
        } else {
            toast.setText(content);
        }
        toast.show();
    }

}
